package geometry;

import java.util.Random;
import grammar.Design;

public class ShapeAnnealer {

	public static int RandRule() { 
		Random randomGenerator = new Random(System.currentTimeMillis());
		return randomGenerator.nextInt(5) + 1;
	
	} 
	
	public static void Anneal() {
		
		Design dsafsda = new Design();
		System.out.print("\n Start of Simulation");
		boolean Terminate = false;
		
		long time = System.nanoTime();
		while (Terminate == false) {
					;
			int ChosenRule = RandRule() ;
//			int SnakeGeomNew = ApplyRule(SnakeGeom, ChosenRule);
//			SnakeGeomNew = Check(SnakeGeom, SnakeGeomNew);
//			SnakeGeom = SnakeGeomNew;
//			System.out.print("\n value of snakey : " + SnakeGeom);
//			System.out.print("\n value of new snakey : " + SnakeGeomNew);
//			Terminate = Exit(SnakeGeomNew);
//			System.out.print("\n Value of Snake : "+ SnakeGeomNew);
		}
		long timenew = System.nanoTime();
		time = timenew-time;
		System.out.print("\n Time : " + time);
	}
	
	public static int ApplyRule(int SnakeGeom, int ChosenRule) { 
		return (SnakeGeom + ChosenRule); 
		
	}
		
	public static int Check(int SnakeGeom, int SnakeGeomNew) {
		Random randomGenerator = new Random(); 
		int Overlap = randomGenerator.nextInt(2);
//		System.out.print("\n value of check : " + Overlap);
		
		     if (Overlap == 1) {
		         return SnakeGeomNew;
		     } else {
		         return SnakeGeom;
		     }
		}

	public static int Evaluate(int SnakeGeom, int SnakeGeomNew) {
		Random randomGenerator = new Random(); 
		int EvalGeom = randomGenerator.nextInt(10);
		
		if (SnakeGeom == SnakeGeomNew) {
			return SnakeGeom;
	    } else if ( SnakeGeomNew > SnakeGeom) {
	    	return SnakeGeomNew;
	    } else if (SnakeGeomNew < SnakeGeom && EvalGeom > 9) {
	    	return SnakeGeomNew; 
	    } else { 
	    	return SnakeGeom;
	    }
	}
	
	public static boolean Exit(int SnakeGeomNew) {
		
		if (SnakeGeomNew > 50) {
			return true; 
		} else { 
			return false; 
		}
	
	}
	
}


 